package com.jlpay.openapi.demo.openmerch.device;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.DeviceEnum;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.request.DeviceAddRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.response.DeviceAddResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author dengwenning
 * @since 2024/4/24
 **/
public class AddService {

    private static final Logger LOGGER = LoggerFactory.getLogger(AddService.class);

    public static void main(String[] args) {
        DeviceAddRequest deviceAddRequest = buildDeviceAddRequest();
        DeviceAddResponse deviceAddResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(deviceAddRequest, DeviceAddResponse.class);
        LOGGER.info("加机响应:{}", JsonUtils.toString(deviceAddResponse));
    }

    private static DeviceAddRequest buildDeviceAddRequest(){
        DeviceAddRequest deviceAddRequest = new DeviceAddRequest();

        deviceAddRequest.setDeviceType(DeviceEnum.TERM);
        deviceAddRequest.setMerchNo("84944035812S123");
        deviceAddRequest.setDeviceNo("AQR1000030");
        deviceAddRequest.setPrintMerchName("测试");
        deviceAddRequest.setDetAddress("广东");
        deviceAddRequest.setShopId("01");

        return deviceAddRequest;
    }

}
